﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Activation;
using System.Text;
using System.Web.Security;
using Keiho.ServiceModel;

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class RolesService : IRolesService
{
    public ServiceResponse<string[]> GetRolesForUser()
    {
        try
        {
            return new ServiceResponse<string[]> { Result = Roles.GetRolesForUser() };
        }
        catch (Exception ex)
        {
            return new ServiceResponse<string[]> { MessageType = MessageType.Error, Message = ex.Message };
        }
    }

    public ServiceResponse<bool> IsUserInRole(string roleName)
    {
        try
        {
            return new ServiceResponse<bool> { Result = Roles.IsUserInRole(roleName) };
        }
        catch (Exception ex)
        {
            return new ServiceResponse<bool> { MessageType = MessageType.Error, Message = ex.Message };
        }
    }
}
